#include "GMM.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <random>
#include <time.h>
using namespace std;

void test(GMM& gmm)
{
    srand((int)time(0));
    vector<double> datas;
    int i;
    double d;

    const double mean[2] = {10.f,124.f};
    const double stddev[2] = {9.f,12.f};
    std::default_random_engine generator(time(0));
    std::normal_distribution<double> dist0(mean[0], stddev[0]), dist1(mean[1], stddev[1]);
    for (i=0;i<40;i++)
    {
        d=dist0(generator);
        datas.push_back(d);
        d=dist1(generator);
        datas.push_back(d);
    }


    gmm.Init(datas,2);
    gmm.train();
    for (int i = 0; i < 10; ++i) {
        d=rand()% 220 + 0.25f;
        cout << d << " belong to: " << gmm.predicate(d) << "\n";
    }
    gmm.print();
}

int main(int argc, char *argv[])
{
    GMM gmm;
    test(gmm);
    return 0;
}


